<?php
namespace app\yunda\model;

use think\Model;
use traits\model\SoftDelete;

/**
 * 佣金记录表
 * @package app\yunda\model
 */
class Yjrecord extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $table = 'dp_yj_record';
    protected $autoWriteTimestamp = true;

    /**
     * 获取用户某级别佣金总额
     * @param string $openid //用户
     * @param int $level //佣金等级
     * @return float|int
     */
    public static function getLevelMoney($openid='',$level=1)
    {
        $total_money=self::where(['openid'=>$openid,'level'=>$level])->sum('get_money');
        return $total_money;
    }


}
